package com.seanLab.domain;

import com.seanLab.dto.SuggestArticleKeywordsDto;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * 仅做测试使用
 * Created by ailly on 18-1-3.
 */
@Document(collection = "#{getTestDocs}")
public class TestDocs implements Serializable {
    @Id
    private String articleID;

    private String types;
    private String source;
    private String channel;
    private List<List<Category>> category;
    private List<String> tags;
    private String url;
    private String title;
    private String content;
    private String code;
    private int cateID;

    public UserDocs toUserDocs(TestDocs testDocs) {
        UserDocs userDocs = new UserDocs();
        userDocs.setArticleID(testDocs.getArticleID());
        userDocs.setTypes(testDocs.getTypes());
        userDocs.setSource(testDocs.getSource());
        userDocs.setChannel(testDocs.getChannel());
        userDocs.setDocCategory(testDocs.getCateID());
        userDocs.setTags(testDocs.getTags());
        userDocs.setUrl(testDocs.getUrl());
        userDocs.setTitle(testDocs.getTitle());
        userDocs.setContent(testDocs.getContent());

        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        String dateString = formatter.format(currentTime);

        userDocs.setTestLabel("TEST-" + dateString);

        return userDocs;
    }

    public int getCateID() {
        return cateID;
    }

    public void setCateID(int cateID) {
        this.cateID = cateID;
    }

    public String getArticleID() {
        return articleID;
    }

    public void setArticleID(String articleID) {
        this.articleID = articleID;
    }

    public String getTypes() {
        return types;
    }

    public void setTypes(String types) {
        this.types = types;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getChannel() {
        return channel;
    }

    public void setChannel(String channel) {
        this.channel = channel;
    }

    public List<List<Category>> getCategory() {
        return category;
    }

    public void setCategory(List<List<Category>> category) {
        this.category = category;
    }

    public List<String> getTags() {
        return tags;
    }

    public void setTags(List<String> tags) {
        this.tags = tags;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }
}
